package com.example.studentproj.repository;
import com.example.studentproj.model.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;


@Repository
public interface StudentRepository extends JpaRepository<Student, Long> {

    //通过学生名字来查找学生数据
    @Query("select s from Student s where s.name like %:name%")
    List<Student> findByName(@Param("name") String name);





    //通过班级名字来查找学生数据
    @Query("select s from Student s where s.className = :name")
    List<Student> findByClassName(@Param("name") String name);

}
